﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace pufflesweb.admin
{
    public partial class Ahelpupdate : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string HID = Request.QueryString["HID"];

                PModel.Help help = PBLL.Help.Getuser(int.Parse(HID));

                this.hname.Text = help.Hname;
                this.hsex.Text = help.Hsex.ToString();
                this.hage.Text = help.Hage.ToString();
                this.hstate.Text = help.Hstate.ToString();
                this.hvaccine.Text = help.Hvaccine.ToString();
                this.htext.Text = help.Htext;
                this.himage.Text = help.Himage;
                this.HiddenField1.Value = help.HID.ToString();
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            PModel.Help help = new PModel.Help();
            help.HID = int.Parse(this.HiddenField1.Value);
            help.Hsex = int.Parse(this.hsex.Text);
            help.Hage = int.Parse(this.hage.Text);
            help.Htext = this.htext.Text;
            help.Hname = this.hname.Text;
            help.Hstate = int.Parse(this.hstate.Text);
            help.Hvaccine = int.Parse(this.hvaccine.Text);
            help.Himage = this.himage.Text;
            if (PBLL.Help.update(help))
            {
                PF.JsHelper.AlertAndParentUrl("修改保存成功", "main.aspx");
            }
            else
            {
                PF.JsHelper.AlertAndParentUrl("修改失败,请重新输入", "Ahelpupdate.aspx");
            }
        }
    }
}